<template>
  <el-col :span="5" class="club-show">
    <div class="club-card-content">
      <div class="card-header">
        <img :src="club.image" class="image" />
      </div>
      <div class="club-info">
        <div class="club-name">
          <el-icon class="icon" :size="20">
            <UserFilled />
          </el-icon>
          <span>{{ club.name }}</span>
        </div>
        <div class="description">
          <el-icon class="icon" :size="16">
            <DocumentFilled />
          </el-icon>
          <span>{{ club.description }}</span>
        </div>
      </div>

      <el-button type="primary" @click="navigateToClub" class="view-button">
        <el-icon class="icon">
          <View />
        </el-icon>
        查看详情
      </el-button>

    </div>
  </el-col>
</template>

<script>
import { UserFilled, DocumentFilled, View } from '@element-plus/icons-vue'

export default {
  name: 'ClubShow',
  components: {
    UserFilled,
    DocumentFilled,
    View
  },
  props: {
    club: {
      type: Object,
      required: true
    }
  },
  methods: {
    navigateToClub() {
      // 使用 this.club.id 获取当前 club 的 id
      const clubId = this.club.id;
      // 导航到 ClubDetail 路由，并将 clubId 作为参数传递
      this.$router.push({ name: "ClubDetail", query: { clubId: clubId } });
    }
  }
}
</script>


<style scoped>
.club-show {
  margin-bottom: 50px;
}

.club-card-content {
  width: 280px;
  height: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  border-radius: 12px;
  background-color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
}

.club-card-content:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.card-header {
  width: 100%;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 12px;
  overflow: hidden;
}

.image {
  width: 100%;
  height: auto;
}

.club-info {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 24px;
}

.club-name {
  font-size: 1.4em;
  font-weight: bold;
  color: #333;
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.description {
  text-align: left;
  font-size: 14px;
  line-height: 1.6;
  color: #666;
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  margin-bottom: 20px;
}

.icon {
  margin-right: 8px;
  color: #888;
  font-size: 20px;
}

.view-button {
  margin-top: auto;
  background-color: #ffc107;
  color: #fff;
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
}

.view-button .icon {
  font-size: 18px;
  margin-right: 8px;
  color: #fff;
}

.view-button:hover {
  background-color: #ffdb58;
  box-shadow: 0 8px 18px rgba(255, 193, 7, 0.4);
}
</style>